package org.tdconsumer.app;

import java.util.Date;
import java.util.List;

import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.tdinterface.IHelloService;
import org.tdinterface.model.User;

public class Consumer {

	public static void main(String[] args) throws Exception {
		System.out.println("Consumer begin ...");
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "applicationConsumer.xml" });
		context.start();
		IHelloService demoService = (IHelloService) context.getBean("demoService");
		while(true) {
			System.out.println(new Date().toString());
			System.out.println(demoService.sayHello("重庆"));
			List<User> list = demoService.getUserList();
			for(User u:list) {
				System.out.println("user:" + u);
			}
			Thread.sleep(5000);
		}
//		System.out.println(demoService.sayHello("dubbo"));
//		System.out.println("...");

	}

}
